#ifndef _LINKLISTRECTANGLEH_
#define _LINKLISTRECTANGLEH_


#include <iostream>
using namespace std;

#include "rectangleH.h"

class RectangleLinkList
{

	class RectangleNode
	{
	   public:
	
		  Rectangl * data;
          RectangleNode * next;   
	      RectangleNode * prev;
		  
		  RectangleNode(){data = NULL; next = prev = NULL;} // RectangleNode Constructor
		  ~RectangleNode(){if (data) delete data;} // RectangleNode Deconstructor
	};


	RectangleNode * head;
	RectangleNode * tail;
	int sizeOfList;
	
   public:

   RectangleLinkList(){init();} // constructor to reset head tail and size.
   ~RectangleLinkList(){ClearList();}

   void init(); //initilize the List.
   
   void ClearList(); //Clear List.

   void insertNodeToTail(RectangleNode * node);

   void insertNodeToHead(RectangleNode * node);
   
   bool isEmptyList();
   
   void moveToHead(RectangleNode * node);
   
   void AddRecToTail(Rectangl * rct); //receive pointer to allocated Rectangle object and build a new Node and list it to the List.
  
   bool RemoveRecNodeFromList(Rectangl * rct); //receive pointer to allocated Rectangle object and remove the node hosting the object in List and the object itself.

   void DrawList(int drawingOption = 1); //Draw the entire List. 2 drawing options are available. (1/2)

   int GetsizeOfList(); //Get size of List.

   bool FindRectangleInListAngGetOut(int x, int y, Rectangl ** recOut); //true if point is in List and then pulls out the object address, false and NULL otherwise.

   bool checkPointInListOfRectangles(Rectangl ** recOut, int x, int y); //is POINT (x,y) exists in Rectrangle list, if yes(true) recOut point to rectangle

   void drawPointsInListOfRectangles(Rectangl * recIn);

   bool RectangleLinkList::isRecEquals(Rectangl * rec);
};


#endif

